package org.laobai.permission.aspect;

import org.laobai.permission.exception.PermissionException;
import org.laobai.permission.struct.Result;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author jiusan
 * 全局异常捕捉
 */
@RestControllerAdvice
public class HandlerException {
    @ExceptionHandler(value = PermissionException.class)
    public Result handler(PermissionException e) {
        //e.getStackTrace()
        return new Result(e.getCode(), e.getMsg(), false);
    }
}
